package Object;

public class clone {
    public static void main(String[] args) throws CloneNotSupportedException {
        int []date={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0};
        user u1=new user(1,"zhangsan","123zhangsan","girl11",date);
        //方法会在底层帮我们创建一个对象，并把原对象中大数据拷贝进去
        //重写clone方法
        //让javaBean类实现Cloneable接口
        //创建原对象并调用clone就可以了
        user u2= (user) u1.clone();
        int []data=u1.getData();
        data[0]=2;
        //默认是浅克隆
        //重写完才是深克隆
        System.out.println(u1);
        System.out.println(u2);


    }
}
